﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChangeAccount.aspx.cs"
    Inherits="ZX.WebApp.Crm.ChangeAccount" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/container/assets/skins/sam/container.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/button/assets/skins/sam/button.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/layout/assets/skins/sam/layout.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/resize/assets/skins/sam/resize.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/yui_2.9.0/build/datatable/assets/skins/sam/datatable.css" />
    <link href="../../Styles/base.css" rel="stylesheet" type="text/css" />
    <link href="../Scripts/ctrls/Ctrl.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.json-2.2.js" type="text/javascript"></script>
    <script src="../../Scripts/Jquery.form.js" type="text/javascript"></script>
    <script src="../../Scripts/CombinButton.js" type="text/javascript"></script>
        <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datasource/datasource-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/get/get-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/dragdrop/dragdrop-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datatable/datatable-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/paginator/paginator-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/layout/layout-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/container/container-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/event-delegate/event-delegate-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/resize/resize-min.js"></script>
    <link href="../../Styles/extendTable.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/extend.validate.js" type="text/javascript"></script>
    <script src="../Scripts/ctrls/jquery.UserSelect.js" type="text/javascript"></script>
</head>
<body class="yui-skin-sam">
    <form id="form1" runat="server">
    <div>
        <table class="tableContent">
            <tr>
                <td>
                    &nbsp;(用户切换)选择用户：<span style="color: Red">*</span>
                </td>
                <td>
                    <input type="hidden" id="PM" runat="server" />
                    <input type="text" id="txtPM" runat="server" SValue="" SText="" style="width:300px;"  ctrlType="SingleUser" entity="V_DataUser" event="SetValue()"/>
                    
                </td>
                <td>
                     <button id="btnPM" name="Z" runat="server" type="button" class="btnCheck" style="width: 50px;"> 选择</button>&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="btnDone" runat="server" Text="切换用户" class="btnCheck" OnClientClick="return checkSure('txtPM','')"
                        Style="width: 80px; height: 30px;" OnClick="btnDone_Click" />
                </td>
            </tr>
            <tr><td colspan="3">&nbsp;</td></tr>
            <tr>
                <td colspan="3">&nbsp;<input type="button" id="btnClearAll" value="一键清理" class="btnCheck" /><span style="color:Red">&nbsp;&nbsp;&nbsp;&nbsp;备注：待办任务显示无数据处理,清缓存处理</span></td>
            </tr>
        </table>
        <table class="tableContent" style="display:none">
            <tr><td colspan="2">&nbsp;</td></tr>
            <tr>
                <td>
                    &nbsp;原客户经理：<span style="color: Red">*</span>
                     <input type="hidden" id="OldCus" runat="server" />
                    <input type="text" id="txtOldCus" runat="server" disabled="disabled" style="width: 50px;" />
                    <button id="btnOldCus" name="Z" runat="server" type="button" class="btnCheck" style="width: 50px;">
                        选择</button>&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
                <td>
                     &nbsp;(授权客户)客户经理：<span style="color: Red">*</span>
                     <input type="hidden" id="NewCus" runat="server" />
                    <input type="text" id="txtNewCus" runat="server" disabled="disabled" style="width: 50px;" />
                    <button id="btnNewCus" name="Z" runat="server" type="button" class="btnCheck" style="width: 50px;">
                        选择</button>&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="btnAuth" runat="server" Text="授权" class="btnCheck" OnClientClick="return checkSure('txtOldCus','txtNewCus')"
                        Style="width: 80px; height: 30px;" OnClick="btnAuth_Click" />
                </td>
            </tr>
        </table>
    </div>
    <div id="dialog1" class="yui-pe-content">
        <div class="hd">
            信息选择</div>
        <div class="bd">
            <iframe id="EditUIWindow1" frameborder="0" src="" style="width: 100%; height: 100%;
                margin: 0px; padding: 0px;"></iframe>
        </div>
    </div>
    </form>
</body>
<script type="text/javascript">
    var SetValue = function () {
        //alert($("#txtPM").attr("SValue"));
        $("#PM").val($("#txtPM").attr("SValue"));

    }
 


    var _CustomerId = "", _State = "0";
    /* 对应的方法和ID*/
    var _fn, _id;
    function ShowDialog(fn, id, src) {
        _fn = fn;
        _id = id;
        document.getElementById("EditUIWindow1").src = src;
        YAHOO.example.container.dialog1.show();
    }
    function ShowDialog2(fn, id) {
        _fn = fn;
        _id = id;
        YAHOO.example.container.dialog1.show();
    }
    //一键清理事件
    $(document).ready(function () {
        $("#btnClearAll").click(function () {
            if (confirm("您确定一键清理吗？")) {
                var SaveUrl = "../Extend/AjaxData/DataProcessin.aspx" + "?r=" + Math.random() + "&action=clear";
                YAHOO.util.Connect.asyncRequest('POST', SaveUrl, {
                    success: function (res) {
                        try {
                            var str = res.responseText;
                            if (str == "1") {
                                alert("操作成功!");
                                return;
                            } else {
                                alert(str);
                            }
                        }
                        catch (e) {
                        }
                        finally {
                        }
                    },
                    failure: function (error) {
                        alert("数据错误：" + error.statusText);
                    }
                }, null);
            }
        });
    });
    function checkSure(objOld, objNew) {
        if (objNew != "") {
            if ($("#" + objOld).val() == "") {
                alert("您需选择原客户经理");
                $("#" + objOld).focus();
                return false;
            }
            if ($("#" + objNew).val() == "") {
                alert("您需选择授权用户");
                $("#" + objNew).focus();
                return false;
            }
        } else {
            if ($("#" + objOld).val() == "") {
                alert("您需选择用户");
                $("#" + objOld).focus();
                return false;
            }
        }
        if (!confirm("您确定要执行当前操作吗?")) {
            return false;
        } else {alert("操作成功");}
    }
    YAHOO.namespace("example.container");
    YAHOO.util.Event.onDOMReady(function () {
        var handleSubmit = function () {
            var editwindow = document.getElementById("EditUIWindow1");
            if (editwindow) {
                if (_id == "btnPM" || _id == "btnOldCus" || _id == "btnNewCus") {
                    _State = "0";
                    editwindow.contentWindow.ChooseInfo();
                }
            }
            if (_State != "") {
                YAHOO.example.container.dialog1.hide();
            }
        };
        var handleCancel = function () {
            this.cancel();
        };
        var handleSuccess = function (o) {
            var response = o.responseText;
            response = response.split("<!")[0];
            document.getElementById("resp").innerHTML = response;
        };
        var handleFailure = function (o) {
            alert("Submission failed: " + o.status);
        };
        YAHOO.example.container.dialog1 = new YAHOO.widget.Dialog("dialog1",
					        { width: "620px",
					            height: "450px",
					            fixedcenter: true,
					            visible: false,
					            draggable: true,
					            close: true,
					            autofillheight: "body",
					            constraintoviewport: true,
					            buttons: [{ text: "确定", handler: handleSubmit, isDefault: true },
								        { text: "取消", handler: handleCancel}]
					        });
        YAHOO.example.container.dialog1.callback = { success: handleSuccess, failure: handleFailure };
        YAHOO.example.container.dialog1.render();
        //拖动大小1
        var resize = new YAHOO.util.Resize("dialog1", {
            handles: ["br"],
            autoRatio: false,
            minWidth: 450,
            minHeight: 300,
            status: false
        });
        resize.on("startResize", function (args) {
            if (this.cfg.getProperty("constraintoviewport")) {
                var D = YAHOO.util.Dom;

                var clientRegion = D.getClientRegion();
                var elRegion = D.getRegion(this.element);

                resize.set("maxWidth", clientRegion.right - elRegion.left - YAHOO.widget.Overlay.VIEWPORT_OFFSET);
                resize.set("maxHeight", clientRegion.bottom - elRegion.top - YAHOO.widget.Overlay.VIEWPORT_OFFSET);
            } else {
                resize.set("maxWidth", null);
                resize.set("maxHeight", null);
            }

        }, YAHOO.example.container.dialog1, true);
        resize.on("resize", function (args) {
            var panelHeight = args.height;
            this.cfg.setProperty("height", panelHeight + "px");
        }, YAHOO.example.container.dialog1, true);
        //拖动大小2
        var resize = new YAHOO.util.Resize("dialog2", {
            handles: ["br"],
            autoRatio: false,
            minWidth: 300,
            minHeight: 250,
            status: false
        });
        resize.on("startResize", function (args) {
            if (this.cfg.getProperty("constraintoviewport")) {
                var D = YAHOO.util.Dom;

                var clientRegion = D.getClientRegion();
                var elRegion = D.getRegion(this.element);

                resize.set("maxWidth", clientRegion.right - elRegion.left - YAHOO.widget.Overlay.VIEWPORT_OFFSET);
                resize.set("maxHeight", clientRegion.bottom - elRegion.top - YAHOO.widget.Overlay.VIEWPORT_OFFSET);
            } else {
                resize.set("maxWidth", null);
                resize.set("maxHeight", null);
            }

        }, YAHOO.example.container.dialog2, true);
        resize.on("resize", function (args) {
            var panelHeight = args.height;
            this.cfg.setProperty("height", panelHeight + "px");
        }, YAHOO.example.container.dialog2, true);
    });
</script>
</html>
